package com.kevin.util.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class StringSplitOutTag  extends TagSupport{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 134546456L;
	private String content;
	private String sp;
	

	

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}	

	public String getSp() {
		return sp;
	}

	public void setSp(String sp) {
		this.sp = sp;
	}

	@Override
	public int doEndTag() throws JspException {
		// TODO Auto-generated method stub
		content = content.trim();
//		content=replaceHtml(content);
		try {	
			String newStr = "";
			if(content.startsWith(sp))
				content = content.replaceFirst(sp, "");
			newStr = content.replace(sp, "<br/><br/>");
			pageContext.getOut().print(newStr);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return SKIP_BODY;
	}

	@Override
	public int doStartTag() throws JspException {
		// TODO Auto-generated method stub
		return EVAL_PAGE;
	}
	
}
